//
//  SVProgressHUD+MCProgressHUD.m
//  ZXZX
//
//  Created by menhao on 2018/9/18.
//  Copyright © 2018年 TLYL01. All rights reserved.
//

#import "SVProgressHUD+MCProgressHUD.h"
#import <objc/runtime.h>
static SVProgressHUD *_hub;
static char *CloudoxKey = "CloudoxKey";
@implementation SVProgressHUD (MCProgressHUD)


-(void)setCompleteCallBack:(void (^)(void))completeCallBack{
    objc_setAssociatedObject(self, CloudoxKey, completeCallBack, OBJC_ASSOCIATION_COPY_NONATOMIC);
}


- (void (^)(void))completeCallBack{
    return objc_getAssociatedObject(self, CloudoxKey);
}

+ (void)showInfoWithStatus:(NSString *)status withComplete:(void (^)())complete{
    SVProgressHUD *hub = [[SVProgressHUD alloc] init];
    hub.completeCallBack = complete;
    _hub = hub;
    [SVProgressHUD setMinimumDismissTimeInterval:1];
    [SVProgressHUD showInfoWithStatus:status];
    
}
- (void)dismiss{
    [SVProgressHUD dismiss];
    if (_hub.completeCallBack) {
        _hub.completeCallBack();
        _hub = nil;
}

}

@end
